package com.sm.bo;

import java.util.ArrayList;
import java.util.Date;

import android.os.Parcel;
import android.os.Parcelable;

public class Student implements Parcelable{
	
	private String name = "";
	private String adress = "";
	private String telNumber = "";
	
	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getAdress() {
		return adress;
	}

	public void setAdress(String adress) {
		this.adress = adress;
	}

	public String getTelNumber() {
		return telNumber;
	}

	public void setTelNumber(String telNumber) {
		this.telNumber = telNumber;
	}

	public Date getSubscriptionDate() {
		return subscriptionDate;
	}

	public void setSubscriptionDate(Date subscriptionDate) {
		this.subscriptionDate = subscriptionDate;
	}

	public ArrayList<String> getCourses() {
		return courses;
	}

	public void setCourses(ArrayList<String> courses) {
		this.courses = courses;
	}

	private Date subscriptionDate;
	
	private ArrayList<String> courses;
	
	public Student() {
		subscriptionDate = new Date();
	}

	public Student(String nom, String adresse, String telNum) {
		super();
		this.name = nom;
		this.adress = adresse;
		this.telNumber = telNum;
		subscriptionDate = new Date();
		courses = new ArrayList<String>();
	}
	
	public Student(String nom, String adresse, String telNum, Date subsciptionDate, ArrayList<String> courses) {
		super();
		this.name = nom;
		this.adress = adresse;
		this.telNumber = telNum;
		this.subscriptionDate = subsciptionDate;
		this.courses = courses;
	}
	
	@SuppressWarnings("unchecked")
	public Student(Parcel in) {
		this.name = in.readString();
		this.adress = in.readString();
		this.telNumber = in.readString();
		subscriptionDate = new Date(in.readLong());
		courses = in.readArrayList(ArrayList.class.getClassLoader());
	}

	@Override
	public int describeContents() {
		return 0;
	}

	@Override
	public void writeToParcel(Parcel dest, int flags) {
		dest.writeString(name);
		dest.writeString(adress);
		dest.writeString(telNumber);
		dest.writeLong(subscriptionDate.getTime());
		dest.writeArray(courses.toArray());
	}
	
	public static final Parcelable.Creator<Student> CREATOR = new Parcelable.Creator<Student>()
	{
		@Override
		public Student createFromParcel(Parcel source)
		{
			return new Student(source);
		}

		@Override
		public Student[] newArray(int size)
		{
			return new Student[size];
		}
	};
}